﻿module WingBeats.DataMapping

open System.Reflection

module Parts =
    type name         = string
    type mappingParts = mappingPart list
    and  choices      = choice list

    and choice  = | Choice  of name * obj * bool
    and mapping = | Mapping of name * mappingParts

    and mappingPart =
        | Section      of name * mappingParts
        | SingleChoice of name * choices
        | MultiChoice  of name * choices
        | Property     of name * string
    
let mapping name parts =
    Parts.Mapping (name, parts)

let section name parts =
    Parts.Section (name, parts)

let property name value =
    Parts.Property (name, value)

let singleChoice name choices =
    Parts.SingleChoice (name, choices)
    
let multiChoice name choices =
    Parts.MultiChoice (name, choices)
    
let choice name value selected =
    Parts.Choice (name, value, selected)
    

(*let autoMap o =
    mapping 
        (o.ToString())
        [
            System.Reflection.PropertyAttributes
            // Via reflection, get the properties and map them to relevant mappingParts
        ]*)